FROM openjdk:8-jre-alpine3.9

MAINTAINER 756585379@qq.com

# 构建命令 docker build 中可以用 --build-arg <参数名>=<值> 来覆盖。
ARG envID=dev
ARG APP_VERSION=1.0

ENV TZ=Asia/Shanghai
ENV envID ${envID}
ENV APP_VERSION ${APP_VERSION}
ENV MEM_OPTS '-Xms128m -Xmx128m'

RUN mkdir -p /opt/project/

#COPY startup.sh /opt/project
ADD startup.sh /opt/project
ADD target/*.jar /opt/project/app.jar

RUN chmod +x /opt/project/startup.sh && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /opt/project

EXPOSE 9999

#下面三个都可以
#ENTRYPOINT ["java","-jar","/app.jar","&"]
#CMD ["java","-jar","/app.jar","&"]

# java -Xms128m -Xmx128m -jar -Dspring.profiles.active=dev /app.jar
ENTRYPOINT ["sh", "startup.sh"]

